<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		window.onload = function(){

			oDiv =document.getElementById("div1");


			changeStyle("color","red");
			function changeStyle(sty,val) {
			// body...
			oDiv.style[sty]=val;
		}

	</script>
</head>
<body>
	<div id="div1">你好</div>
</body>
</html>